@extends('adminDialog')

@section('content')
    <form action="{{url('admin/stores/auth/'.$user->id)}}" method="POST" class="J_ajaxForm">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div class="pop_cont pop_table" style="height:500px;">
            <table width="100%">
                <tbody>
                <tr>
                    <th><label>账号</label></th>
                    <td>
                        {{$user->name}}
                    </td>
                </tr>

                <tr>
                    <th><label>联系人姓名</label></th>
                    <td>
                        {{$user->real_name}}
                    </td>
                </tr>

                <tr>
                    <th><label>店铺名称</label></th>
                    <td>
                        {{$user->store->store_name}} &nbsp;&nbsp;[ TEL: {{$user->store->store_phone}} ]
                    </td>
                </tr>

                <tr>
                    <th><label>店铺地址</label></th>
                    <td>
                        {{$user->store->store_address}}
                    </td>
                </tr>

                <tr>
                    <th><label>主营类目</label></th>
                    <td>
                        {{$user->store->parent_cate->name}} - {{$user->store->cate->name}}
                        @if ($user->store->store_type) &nbsp;&nbsp;&nbsp;（支持外卖） @endif
                    </td>
                </tr>

                <tr>
                    <th><label for="id_pic1">联系人身份证</label></th>
                    <td>
                        <div class="idpicWp">
                            <input type="hidden" name="id_pic1" id="id_pic1" value="{{$user->id_pic1}}"/>
                            <div class="upload_btn cc"><img style="vertical-align: middle" src="{{url('/img/auth-'.intval($user->id_pic1).'/100-80')}}" /></div>
                            <a style="display: block;" target="_blank" href="{{url('img/auth-'.intval($user->id_pic1).'/600-0-1')}}">[查看正面大图]</a>
                        </div>
                        <div class="idpicWp">
                            <input type="hidden" name="id_pic2" id="id_pic2" value="{{$user->id_pic2}}"/>
                            <div class="upload_btn cc"><img style="vertical-align: middle" src="{{url('/img/auth-'.intval($user->id_pic2).'/100-80')}}" /></div>
                            <a style="display: block;" target="_blank" href="{{url('img/auth-'.intval($user->id_pic2).'/600-0-1')}}">[查看反面大图]</a>
                        </div>
                        <div class="idpicWp">
                            <input type="hidden" name="id_pic3" id="id_pic3" value="{{$user->id_pic3}}"/>
                            <div class="upload_btn cc"><img style="vertical-align: middle" src="{{url('/img/auth-'.intval($user->id_pic3).'/100-80')}}" /></div>
                            <a style="display: block;" target="_blank" href="{{url('img/auth-'.intval($user->id_pic3).'/600-0-1')}}">[查看手持证件]</a>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th><label for="id_pic1">店铺证件图片</label></th>
                    <td>
                        <div class="idpicWp">
                            <input type="hidden" name="store_pic" id="store_pic" value="{{$user->store->store_pic}}"/>
                            <div class="upload_btn cc"><img style="vertical-align: middle" src="{{url('/img/auth-'.intval($user->store->store_pic).'/100-80')}}" /></div>
                            <a style="display: block;" target="_blank" href="{{url('img/auth-'.intval($user->store->store_pic).'/600-0-1')}}">[查看店面大图]</a>
                        </div>
                        <div class="idpicWp">
                            <input type="hidden" name="store_license" id="store_license" value="{{intval($user->store->store_license)}}"/>
                            <div class="upload_btn cc"><img style="vertical-align: middle" src="{{url('/img/auth-'.intval($user->store->store_license).'/100-80')}}" /></div>
                            <a style="display: block;" target="_blank" href="{{url('img/auth-'.intval($user->store->store_license).'/600-0-1')}}">[查看营业执照大图]</a>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th><label for="store_trade_fee">交易手续费率</label></th>
                    <td>
                        <input type="number" id="store_trade_fee" name="store_trade_fee" class="input length_1" value="{{$user->store->trade_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_online_pay_fee">线上支付返利</label></th>
                    <td>
                        <input type="number" id="store_online_pay_fee" name="store_online_pay_fee" class="input length_1" value="{{$user->store->online_pay_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_offline_pay_fee">线下刷卡返利</label></th>
                    <td>
                        <input type="number" id="store_offline_pay_fee" name="store_offline_pay_fee" class="input length_1" value="{{$user->store->offline_pay_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_coin_pay_fee">金币支付返利</label></th>
                    <td>
                        <input type="number" id="store_coin_pay_fee" name="store_coin_pay_fee" class="input length_1" value="{{$user->store->coin_pay_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_agent_fee">代理服务提点</label></th>
                    <td>
                        <input type="number" id="store_agent_fee" name="store_agent_fee" class="input length_1" value="{{$user->store->agent_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_agent_tz_fee">T+0提现代理分润</label></th>
                    <td>
                        <input type="number" id="store_agent_tz_fee" name="store_agent_tz_fee" class="input length_1" value="{{$user->store->agent_tz_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_agent_to_fee">T+1提现代理分润</label></th>
                    <td>
                        <input type="number" id="store_agent_to_fee" name="store_agent_to_fee" class="input length_1" value="{{$user->store->agent_to_fee}}"/> %
                    </td>
                </tr>

                <tr>
                    <th><label for="store_capita">人均消费</label></th>
                    <td>
                        <input type="number" id="store_capita" name="store_capita" class="input length_2" value="{{$user->store->store_capita}}"/> 元
                    </td>
                </tr>

                <tr>
                    <th><label for="store_sn">商户编号</label></th>
                    <td>
                        <input type="text" id="store_sn" name="store_sn" class="input length_3" value="{{$user->store->store_sn}}"/>
                    </td>
                </tr>

                <tr>
                    <th><label for="auth_status">认证状态</label></th>
                    <td>
                        <input type="radio" @if($user->auth_status) checked="checked" @endif name="auth_status" value="1" id="status_1"/><label for="status_1">已通过</label>
                        <input type="radio" @if(!$user->auth_status) checked="checked" @endif name="auth_status" value="0" id="status_2"/><label for="status_2">未通过</label>
                    </td>
                </tr>

                <tr>
                    <th><label for="remark">审核备注</label></th>
                    <td>
                        <textarea name="remark" id="remark" style="width:340px; resize: none;">{{$user->remark}}</textarea>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="pop_bottom cc">
            <button type="reset" class="btn fr" id="J_dialog_close">取消</button>
            <button type="submit" class="btn btn_submit J_ajax_submit_btn fr mr10" id="J_dialog_close">提交</button>
        </div>
    </form>
@stop

@section('style')
    <style>
        .body_none {width: 500px;}
        .upload_btn {cursor:pointer; display: inline-block;}
        .idpicWp {width:30%; display: inline-block; text-align: center;}
    </style>
@stop

@section('js')
    @parent
    <script src="{{asset('/js/plupload/plupload.full.min.js')}}"></script>
    <script>
        $('.upload_btn').each(function (k, e) {
            k = new plupload.Uploader({
                browse_button : e,
                url : '{{url('/upimg')}}',
                flash_swf_url : '{{asset('/js/plupload/Moxie.swf')}}',
                silverlight_xap_url: '{{asset('/js/plupload/Moxie.xap')}}',
                filters : {
                    mime_types : [
                        {title: '图片文件', extensions: "jpg,gif,png"}
                    ],
                    max_file_size: '10mb'
                },
                multi_selection : false,
                file_data_name  : 'file',
                multipart_params: {'_token': GV.TOKEN, 'dir': 'auth'}
            });
            k.init();

            k.bind('Error', function (uploader, errObject) {
                Wind.dialog.alert(errObject.message);
            });

            k.bind('FilesAdded', function (uploader, files) {
                uploader.start();
            });

            k.bind('FileUploaded', function (uploader, file, responseObj) {
                var ret = $.parseJSON(responseObj.response);
                var button = uploader.getOption('browse_button');
                if (! ret.id)
                    Wind.dialog.alert(ret.message);
                else {
                    $(button).prev('input').val(ret.id);
                    $(button).find('img').attr('src', '{!! url("img/auth-' + ret.id + '/100-80") !!}');
                    $(button).next('a').attr('href', '{!! url("img/auth-' + ret.id + '/600-0-1") !!}');
                }
            });
        });

    </script>
@stop